import { forwardRef, Module } from '@nestjs/common';
import { SystemUserService } from './system-user.service';
import { SystemUserController } from './system-user.controller';
import { MongooseModule } from '@nestjs/mongoose';
import { SystemUserSchema } from './schemas/system-user.schema';
import { AuthSchema } from './schemas/auth.schema';
import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from 'src/global-type';
import { SystemLogModule } from 'src/system-log/system-log.module';

@Module({
  imports: [
    MongooseModule.forFeature([
      {
        name: 'SystemUser',
        collection: 'system_users',
        schema: SystemUserSchema,
      },
      {
        name: 'Auth',
        collection: 'auths',
        schema: AuthSchema,
      },
    ]),
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: '12h' },
    }),
    forwardRef(() => SystemLogModule),
  ],
  providers: [SystemUserService],
  controllers: [SystemUserController],
  exports: [SystemUserService],
})
export class SystemUserModule {}
